<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

// 默认首页
Route::get('/', function () {
    return 'Hello, 纸条盲盒API!';
});

// 微信授权相关
Route::group('api/wechat', function () {
    Route::get('oauth_url', 'WechatController/oauthUrl');
    Route::get('oauth_callback', 'WechatController/oauthCallback');
    Route::post('payment/notify', 'WechatController/paymentNotify');
});

// 用户相关
Route::group('api/user', function () {
    Route::get('info', 'UserController/info');
    Route::post('update', 'UserController/update');
    Route::get('team', 'UserController/team');
    Route::get('commissions', 'UserController/commissions');
    Route::post('bind_parent', 'UserController/bindParent');
    Route::get('check_upgrade', 'UserController/checkUpgrade');
    Route::post('upgrade', 'UserController/upgrade');
    Route::post('withdraw', 'UserController/withdraw');
    Route::get('withdraw_records', 'UserController/withdrawRecords');
    Route::get('withdraw_leaderboard', 'UserController/withdrawLeaderboard');
    Route::get('recent_box_orders', 'UserController/recentBoxOrders');
    Route::get('upgrade_conditions', 'UserController/upgradeConditions');
});

// 纸条相关
Route::group('api/note', function () {
    Route::post('submit', 'NoteController/submit');
    Route::post('draw', 'NoteController/draw');
    Route::get('my_notes', 'NoteController/myNotes');
    Route::get('my_draws', 'NoteController/myDraws');
    Route::get('order_status', 'NoteController/orderStatus');
    Route::get('my_notes_detail', 'NoteController/myNotesDetail');
});

// 系统设置相关
Route::group('api/system', function () {
    Route::get('settings', 'SystemController/settings');
});

// 添加文件上传路由
Route::group('api/upload', function () {
    Route::post('file', 'UploadController/file');
    Route::post('image', 'UploadController/image');
});

